﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Tdb.YY.DTO;
using Tdb.YY.Helper;

namespace Tdb.YY.BLL
{
    /// <summary>
    /// 账号 业务逻辑层
    /// </summary>
    public class AccountBLL : BaseBLL
    {
        #region 公开方法

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="pwd">密码</param>
        /// <param name="clientIP">客户端IP</param>
        /// <returns></returns>
        public ResultInfo<string> Login(string pwd, string clientIP)
        {
            var strNow = DateTime.Now.ToString("yyMdH");
            var ret = pwd == strNow;

            var token = "";
            if (ret)
            {
                token = JWTHelper.CreateToken(clientIP);
            }

            return new ResultInfo<string>(ret, ret ? "OK" : "密码不对", token);
        }

        #endregion
    }
}
